function Align(p: Pointer; Alignment: PtrUInt): Pointer;
var x: ptruint;
begin
	result := p;
	x := PtrUInt(result) and (Alignment-1);
	if x > 0 then
		result := pointer(PtrUInt(result)+ptruint(alignment-x));
end;

procedure FillChar(var B; Count: PtrInt; value: byte);
var i: PtrInt;
begin
	for i := 0 to count-1 do
		PByte(ptruint(@b)+PtrUInt(i))^ := value;
end;

procedure FillWord(var B; Count: PtrInt; value: word);
var i: PtrInt;
begin
	for i := 0 to count-1 do
		PWord(ptruint(@b)+PtrUInt(i*2))^ := value;
end;

procedure FillDWord(var B; Count: PtrInt; value: dword);
var i: PtrInt;
begin
	for i := 0 to count-1 do
		PDWord(ptruint(@b)+PtrUInt(i*4))^ := value;
end;

procedure Move(const Src; Var dest; count: PtrInt);
var i: ptrint;
begin
	for i := 0 to count-1 do
		PByte(PtrUInt(@dest)+PtrUInt(i))^ := PByte(PtrUInt(@src)+PtrUInt(i))^;
end;